#include <bits/stdc++.h>
using namespace std;
#define int long long
void solve()
{
    int n;
    cin>>n;
    vector<int>v(n+1),dp(n+1);
    int mx=0,in;
    for(int i=1;i<=n;i++)
    {
        cin>>v[i];
    }
    dp[n]=v[n];
    for(int i=n-1;i>=1;i--)
    {
        if(v[i]<=dp[i+1])dp[i]=dp[i+1]+1;
        else dp[i]=v[i];
    }
    cout<<dp[1]<<endl;
}
signed main()
{
    //ios::sync_with_stdio(false);
    //cin.tie(nullptr);
    int T=1;
    cin>>T;
    while(T--)
    {
       solve();
    }
    return 0;
}